/**
 * @Author       : Hejh(3010733382@qq.com)
 * @Version      : V1.0
 * @Date         : 2024-01-20 10:56:26
 * @Description  : 该工具类用于根据实体的ID获取部分属性
 */

const { Exam } = require('@/models/model')
const { Op } = require('sequelize')

/**
 * @author: Hejh(3010733382@qq.com)
 * @description: 根据考试ID获取考试详情
 * @param {*} ids
 */
module.exports.getExamByIds = async (ids) => {
  let exams = []
  for (let i = 0; i < ids.length; i++) {
    const exam = await Exam.findByPk(BigInt(ids[i]), {
      attributes: ['id', 'name', 'ename']
    })
    exams.push({
      id: exam.id,
      name: exam.name,
      ename: exam.ename
    })
  }
  return exams
}
